import lejos.nxt.Motor;
import lejos.nxt.NXTRegulatedMotor;

public class Moves {
	public static NXTRegulatedMotor LEFT_MOTOR = Motor.A;
	public static NXTRegulatedMotor RIGHT_MOTOR = Motor.C;
	public static NXTRegulatedMotor ULTRASONIC_MOTOR = Motor.B;
	
	public static void main(String[] args){ }
	
	
	
	public static void forward(int speed){		//Method for moving forward
		ULTRASONIC_MOTOR.rotateTo(0);
		LEFT_MOTOR.setSpeed(speed);		//Constant speed on both Engines
		RIGHT_MOTOR.setSpeed(speed);
		LEFT_MOTOR.forward();				
		RIGHT_MOTOR.forward();
	}
	
	public static void backward(int speed){	//Moving backward with same speed on the engines
		ULTRASONIC_MOTOR.rotateTo(180);
		LEFT_MOTOR.setSpeed(speed);
		RIGHT_MOTOR.setSpeed(speed);
		LEFT_MOTOR.backward();
		RIGHT_MOTOR.backward();
	}
	
	public static void stop(){					//Stops both Motors
		LEFT_MOTOR.stop();
		RIGHT_MOTOR.stop();
	}
	
	public static void turnForward(int speedA, int speedC){	//Turn around with the front of the robot
		LEFT_MOTOR.setSpeed(speedA);						//Direction can be chosen or set randomly
		RIGHT_MOTOR.setSpeed(speedC);
		LEFT_MOTOR.forward();								//only able to turn with the front
		RIGHT_MOTOR.forward();
	}
	
	public static void turnBackward(int speedA, int speedC){	//Turn around with the back of the robot
		LEFT_MOTOR.setSpeed(speedA);
		RIGHT_MOTOR.setSpeed(speedC);
		LEFT_MOTOR.backward();
		RIGHT_MOTOR.backward();
	}
	public static void turnLeftAtSpot(int degrees){	//Turn around with the back of the robot
		LEFT_MOTOR.rotate(-degrees, true);
		RIGHT_MOTOR.rotate(degrees);
	}
	public static void turnRightAtSpot(int degrees){	//Turn around with the back of the robot
		RIGHT_MOTOR.rotate(-degrees, true);
		LEFT_MOTOR.rotate(degrees);
	}
}
